package com.chain.chl.manager;

import com.chain.chl.ServerHelper;
import com.chain.chl.model.BaseResponse;
import com.chain.chl.model.TianApiModel;
import com.chain.chl.model.card.Card;
import com.chain.chl.service.CardService;
import com.chain.chl.service.TianService;
import com.google.gson.JsonObject;

import java.util.List;

import baoyunfs.deviceid.DeviceIdManager;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
import rx.Observable;

public class TianManager {
    private volatile static TianManager instance;

    public static TianManager getInstance() {
        if (instance == null) {
            synchronized (TianManager.class) {
                if (instance == null) {
                    instance = new TianManager();
                }
            }
        }
        return instance;
    }

    private TianService service;

    private TianManager() {
        Retrofit retrofit = new Retrofit.Builder()
            .addConverterFactory(GsonConverterFactory.create())
            .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
            .baseUrl(ServerHelper.tianUrl)
            .build();
        service = retrofit.create(TianService.class);
    }


    public Observable<BaseResponse<List<TianApiModel>>> getSportsList(int offset) {
        return service.getSportList("965831c7d8400cb5f065e3d783c5296b",20,offset);
    }
}
